﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using log4net.Config;
using System.IO;

namespace AFT.Parking.Foundation.Logging
{
    public class Logger
    {
        static Logger()
        {
            //XmlConfigurator.Configure();
            XmlConfigurator.Configure(new FileInfo(string.Format("{0}Log4net_weixing.config", AppDomain.CurrentDomain.BaseDirectory)));
        }

        /// <summary>
        /// log4net Logger
        /// </summary>
        static readonly ILog _logger = LogManager.GetLogger("systemlog");

        /// <summary>
        /// 记录级别为[Debug]的日志信息
        /// </summary>
        /// <param name="message">日志信息</param>
        public static void Debug(object message)
        {
            _logger.Debug(message);
        }

        /// <summary>
        /// 记录级别为[Debug]的日志信息
        /// </summary>
        /// <param name="message">日志信息</param>
        /// <param name="exception">异常信息</param>
        public static void Debug(object message, Exception exception)
        {
            _logger.Debug(message, exception);
        }

        /// <summary>
        /// 记录级别为[Error]的日志信息
        /// </summary>
        /// <param name="message">日志信息</param>
        public static void Error(object message)
        {
            _logger.Error(message);
        }

        /// <summary>
        /// 记录级别为[Error]的日志信息
        /// </summary>
        /// <param name="message">日志信息</param>
        /// <param name="exception">异常信息</param>
        public static void Error(object message, Exception exception)
        {
            _logger.Error(message, exception);
        }

        /// <summary>
        /// 记录级别为[Fatal]的日志信息
        /// </summary>
        /// <param name="exception">异常信息</param>
        public static void Fatal(object message)
        {
            _logger.Fatal(message);
        }

        /// <summary>
        /// 记录级别为[Fatal]的日志信息
        /// </summary>
        /// <param name="message">日志信息</param>
        /// <param name="exception">异常信息</param>
        public static void Fatal(object message, Exception exception)
        {
            _logger.Fatal(message, exception);
        }

        /// <summary>
        /// 记录级别为[Info]的日志信息
        /// </summary>
        /// <param name="exception">异常信息</param>
        public static void Info(object message)
        {
            _logger.Info(message);
        }

        /// <summary>
        /// 记录级别为[Info]的日志信息
        /// </summary>
        /// <param name="message">日志信息</param>
        /// <param name="exception">异常信息</param>
        public static void Info(object message, Exception exception)
        {
            _logger.Info(message, exception);
        }

        /// <summary>
        /// 记录级别为[Warn]的日志信息
        /// </summary>
        /// <param name="message">日志信息</param>
        public static void Warn(object message)
        {
            _logger.Warn(message);
        }

        /// <summary>
        /// 记录级别为[Warn]的日志信息
        /// </summary>
        /// <param name="message">日志信息</param>
        /// <param name="exception">异常信息</param>
        public static void Warn(object message, Exception exception)
        {
            _logger.Warn(message, exception);
        }

        public static void Test()
        { }
    }
}
